package day1.TraversalBinaryTree;

import org.w3c.dom.Node;

/**
 * @author pacai
 * @version 1.0
 */
public class TraversalBinary {
    private class binaryTree{
        int value;
        binaryTree left;
        binaryTree right;

        public binaryTree(int value) {
            this.value = value;
        }
    }

    binaryTree head;

    public static void pre(binaryTree head){
        if(head == null){
            return;
        }
        System.out.println(head.value);
        pre(head.left);
        pre(head.right);
    }

    public static void post(binaryTree head){
        if(head == null){
            return;
        }
        post(head.left);
        System.out.println(head.value);
        post(head.right);
    }

    public static void pos(binaryTree head){
        if(head == null){
            return;
        }
        pos(head.left);
        pos(head.right);
        System.out.println(head.value);
    }

    public TraversalBinary(binaryTree head) {
        this.head = head;
    }
}

